package model

import "gorm.io/gorm"

type Member struct {
	gorm.Model
	Title            string `gorm:"type:varchar(30)" json:"Title"`
	Price            int    `gorm:"type:int" json:"price"`
	MemberExpireTime int    `gorm:"type:int" json:"memberExpireTime"`
}
type Order struct {
	gorm.Model
	OrderSn          string `gorm:"type:varchar(50)" json:"orderSn"`
	UserId           int    `gorm:"type:int" json:"userId"`
	MemberId         int    `gorm:"type:int" json:"memberId"`
	PayType          int    `gorm:"type:int" json:"payType"`
	Price            int    `gorm:"type:int" json:"price"`
	MemberExpireTime int    `gorm:"type:int" json:"memberExpireTime"`
}

func (o *Order) CreateOrder(db *gorm.DB) error {
	return db.Create(&o).Error
}
func (m *Member) IsMember(db *gorm.DB, id int) error {
	return db.Where("id = ?", id).First(&m).Error
}

func (o *Order) FindOrder(db *gorm.DB) error {
	return db.Find(&o).Error
}
